<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    
    function stu(name){
        this.name = name;
        this.send = function(type){
            this.type = type;
        }
    }


    function 讲师(){
        this.listen = function(t){
            switch(t){
                case "睡觉":
                    console.log("叫醒，揍一顿");break;
                case "学习":
                    console.log("好棒");break;
                case "玩游戏":
                    console.log("制止，揍一顿");break;
            }
        }
    }
    function 班主任(){
        this.listen = function(t){
            switch(t){
                case "睡觉":
                    console.log("叫醒，走，去喝茶");break;
                case "学习":
                    console.log("好棒棒");break;
                case "玩游戏":
                    console.log("制止，走，去我办公室一起玩");break;
            }
        }
    }
    function 校长(){
        this.listen = function(t){
            switch(t){
                case "睡觉":
                    console.log("记下，让班主任叫醒");break;
                case "学习":
                    console.log("棒");break;
                case "玩游戏":
                    console.log("记下，拍照，交给班主任");break;
            }
        }
    }

    function 行政(s){
        this.listen = function(t){
            console.log(s.name + "," + t + ",拍张，反馈校长")
        }
    }

    const s = new stu("张三")
    s.send("玩游戏");

    const ly = new 讲师();
    ly.listen(s.type);

    const clb = new 班主任();
    clb.listen(s.type);

    const jz = new 行政(s);
    jz.listen(s.type)



</script>
</html>